package com.gz.EuchreU.Contants;

import java.util.ArrayList;

import android.util.Log;

public class CardValues {
	public final static int NINE 		= 0;
	public final static int TEN 		= NINE + 1;
	public final static int JACK		= TEN + 1;
	public final static int QUEEN		= JACK + 1;
	public final static int KING		= QUEEN + 1;
	public final static int ACE			= KING + 1;
	
	public final static int LAYER_TABLE = 0;
	public final static int LAYER_CARDS = LAYER_TABLE +1;
	public final static int LAYER_HUD 	= LAYER_CARDS +1;
	
	public static ArrayList<Integer> mRedScores = new ArrayList<Integer>();
	public static ArrayList<Integer> mBlueScores = new ArrayList<Integer>();
	
	private static int cardCount 	= 0;
	private static int currentCard 	= -1;
	private static int mRedScore = 0;
	private static int mBlueScore = 0;
//	private static Scene mScene;
//	private static ScoreBoardHUD mHud;
//	private static UIButton mDealerChip;
//	
//	public static Scene getScene(float w, SmoothCamera pCamera){
//		if(mScene == null){
//			LoadScene(w,pCamera);
//		}
//		return mScene;
//	}
//
//	public static Scene getScene(){
//		return mScene;
//	}
//	
//	private static void LoadScene(float w, SmoothCamera pCamera){
//		mScene = new Scene(3);
//		mScene.setBackground(new ColorBackground(0f, .3f, .04f));
//		mScene.setOnAreaTouchTraversalFrontToBack();
//		
//		mHud = new ScoreBoardHUD(w, pCamera, 1);
//		
//		mDealerChip = new UIButton(0,0,GameStates.getCardWidth()/2, TextureRegions.TEXTURE_DEALER);
//		
//		mScene.getBottomLayer().addEntity(mDealerChip);
//		
//		mScene.setChildScene(mHud);
//	}
//	
//	public static void UpdateHud(){
//		mHud.Update();
//		mDealerChip.MoveTo(GameStates.GetDealerChipLocation());
//	}
//	
//	public static void ResetScene(){
//		Log.d("CardValues","Scene reset...");
//		mScene.getLayer(LAYER_TABLE).clear();
//		mScene.getLayer(LAYER_CARDS).clear();
//		mScene.getLayer(LAYER_HUD).clear();
//		cardCount = 0;
//		currentCard = -1;
//		mRedScore = 0;
//		mBlueScore = 0;
//	}
	
//	public static boolean IsFollow(PlayingCard pCard){
//		if(GameStates.GetCurrentTrickCount() == 0){
//			return true;
//		}
//		else if(pCard.GetSuitID() == GameStates.GetLeadCard().GetSuitID()){
//			return true;
//		}
//		else return false;
//	}
	
	public static void ResetAll(){
		cardCount = 0;
		currentCard = -1;
		mBlueScore = 0;
		mRedScore = 0;
	}
	
	public static String ToString(int pCardID){
		switch (pCardID) {
		case NINE:
			return "9";
		case TEN:
			return "10";
		case JACK:
			return "Jack";
		case QUEEN:
			return "Queen";
		case KING:
			return "King";
		case ACE:
			return "Ace";
		default:
			return "NULL";
		}
	}
	
	public static int getRedScore(){
		return mRedScore;
	}

	public static ArrayList<Integer> getRedScores(){
		return mRedScores;
	}
	
	public static int getBlueScore(){
		return mBlueScore;
	}
	
	public static ArrayList<Integer> getBlueScores(){
		return mBlueScores;
	}
	
	public static void AddScoreRed(int pScore){
		mRedScore+= pScore;
		mRedScores.add(pScore);
		mBlueScores.add(0);
	}
	
	public static void AddScoreBlue(int pScore){
		mBlueScore+= pScore;
		mBlueScores.add(pScore);
		mRedScores.add(0);
	}
	
	public static int getNewCardID()
	{
		cardCount++;
		return cardCount;
	}
	
	public static boolean IsCardTouched(){
		return currentCard >= 0;
	}
	
	public static boolean IsCurrentCard(int pCardID){
		return pCardID == currentCard;
	}
	
	public static int getCurrentCard(){
		return currentCard;
	}
	
	public static void setCurrentCard(int pCardID){
		currentCard = pCardID;
		log("Current card set - " + pCardID);
	}
	
	public static void ResetCurrentCard(){
		currentCard = -1;
		log("Current card reset");
	}
	private static void log(String msg){
		Log.d("CardValues", msg);
	}	
}
